Hunt–Szymanski algorithm